home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
A-B
/
001. Sample.cpt
/
Sample.r
< prev
next >
Wrap
Text File
|
1988-08-01
|
6KB
|
232 lines
/*------------------------------------------------------------------------------
#
# Apple Macintosh Developer Technical Support
#
# MultiFinder-Aware Simple Sample Application
#
# Sample
#
# Sample.r - Rez Source
#
# Copyright © 1988 Apple Computer, Inc.
# All rights reserved.
#
# Versions: 1.0 8/88
#
# Components: Sample.p August 1, 1988
# Sample.c August 1, 1988
# Sample.r August 1, 1988
# Sample.h August 1, 1988
# PSample.make August 1, 1988
# CSample.make August 1, 1988
#
# Sample is an example application that demonstrates how to
# initialize the commonly used toolbox managers, operate
# successfully under MultiFinder, handle desk accessories,
# and create, grow, and zoom windows.
#
# It does not by any means demonstrate all the techniques
# you need for a large application. In particular, Sample
# does not cover exception handling, multiple windows/documents,
# sophisticated memory management, printing, or undo. All of
# these are vital parts of a normal full-sized application.
#
# This application is an example of the form of a Macintosh
# application; it is NOT a template. It is NOT intended to be
# used as a foundation for the next world-class, best-selling,
# 600K application. A stick figure drawing of the human body may
# be a good example of the form for a painting, but that does not
# mean it should be used as the basis for the next Mona Lisa.
#
# We recommend that you review this program or TESample before
# beginning a new application.
------------------------------------------------------------------------------*/
#include "Types.r"
#include "Sample.h"
/* this is a definition for a resource which contains only a rectangle */
type 'RECT' {
rect;
};
/* we use an MBAR resource to conveniently load all the menus */
resource 'MBAR' (rMenuBar, preload) {
{ mApple, mFile, mEdit, mLight }; /* four menus */
};
resource 'MENU' (mApple, preload) {
mApple, textMenuProc,
0b1111111111111111111111111111101, /* disable dashed line, enable About and DAs */
enabled, apple,
{
"About Sample…",
noicon, nokey, nomark, plain;
"-",
noicon, nokey, nomark, plain
}
};
resource 'MENU' (mFile, preload) {
mFile, textMenuProc,
0b0000000000000000000100000000000, /* enable Quit only, program enables others */
enabled, "File",
{
"New",
noicon, "N", nomark, plain;
"Open",
noicon, "O", nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Close",
noicon, "W", nomark, plain;
"Save",
noicon, "S", nomark, plain;
"Save As…",
noicon, nokey, nomark, plain;
"Revert",
noicon, nokey, nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Page Setup…",
noicon, nokey, nomark, plain;
"Print…",
noicon, nokey, nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Quit",
noicon, "Q", nomark, plain
}
};
resource 'MENU' (mEdit, preload) {
mEdit, textMenuProc,
0b0000000000000000000000000000000, /* disable everything, program does the enabling */
enabled, "Edit",
{
"Undo",
noicon, "Z", nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Cut",
noicon, "X", nomark, plain;
"Copy",
noicon, "C", nomark, plain;
"Paste",
noicon, "V", nomark, plain;
"Clear",
noicon, nokey, nomark, plain
}
};
resource 'MENU' (mLight, preload) {
mLight, textMenuProc,
0b0000000000000000000000000000000, /* disable everything, program does the enabling */
enabled, "Traffic",
{
"Red Light",
noicon, nokey, nomark, plain;
"Green Light",
noicon, nokey, nomark, plain
}
};
/* this ALRT and DITL are used as an About screen */
resource 'ALRT' (rAboutAlert) {
{40, 20, 160, 292}, rAboutAlert, {
OK, visible, silent;
OK, visible, silent;
OK, visible, silent;
OK, visible, silent
};
};
resource 'DITL' (rAboutAlert) {
{
{88, 180, 108, 260},
Button {
enabled, "OK"
};
{8, 8, 24, 214},
StaticText {
disabled, "Simple Sample (Traffic Light)"
};
{32, 8, 48, 237},
StaticText {
disabled, "Copyright © 1988 Apple Computer"
};
{56, 8, 72, 136},
StaticText {
disabled, "Brought to you by:"
};
{80, 24, 112, 167},
StaticText {
disabled, "Macintosh Developer " $"CA" "Technical Support"
}
}
};
resource 'WIND' (rWindow, preload, purgeable) {
{60, 40, 290, 160},
noGrowDocProc, visible, noGoAway, 0x0, "Traffic"
};
resource 'RECT' (rStopRect, preload, purgeable) {
{10, 10, 110, 110}
};
resource 'RECT' (rGoRect, preload, purgeable) {
{120, 10, 220, 110}
};
/* we put the latest SIZE template here so we can rez with MPW 2.0 */
type 'SIZE' {
boolean dontSaveScreen,
saveScreen;
boolean ignoreSuspendResumeEvents,
acceptSuspendResumeEvents;
boolean enableOptionSwitch,
disableOptionSwitch;
boolean cannotBackground,
canBackground;
boolean notMultiFinderAware,
multiFinderAware;
boolean notOnlyBackground,
onlyBackground;
boolean dontGetFrontClicks,
getFrontClicks;
unsigned bitstring[9] = 0;
unsigned longint; /* preferred memory size in bytes */
unsigned longint; /* minimum memory size in bytes */
}; /* ignore the warning caused by re-defining SIZE */
/* here is the quintessential MultiFinder friendliness device, the SIZE resource */
resource 'SIZE' (-1) {
dontSaveScreen,
acceptSuspendResumeEvents,
enableOptionSwitch,
canBackground, /* we can background; we don't currently, but our sleep value */
/* guarantees we don't hog the Mac while we are in the background */
multiFinderAware, /* this says we do our own activate/deactivate; don't fake us out */
notOnlyBackground, /* this is definitely note a background-only application! */
dontGetFrontClicks, /* change this is if you want "do first click" behavior like the Finder */
kPrefSize * 1024, /* we made this (preferred) size bigger than the other (minimum) size */
/* so you can have more text & scraps */
kMinSize * 1024 /* we looked at a heap dump while the program was running */
/* it was using about 27K; we added 13K for stack, text & scraps */
};